<!DOCTYPE html>
<html>
<head>
    <title>Intermediate Value Models - Comparison Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1400px;
            margin: 0 auto;
            background-color: white;
            padding: 30px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            border-bottom: 3px solid #4CAF50;
            padding-bottom: 10px;
        }
        h2 {
            color: #555;
            margin-top: 30px;
        }
        table {
            border-collapse: collapse;
            width: 100%;
            margin: 20px 0;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #4CAF50;
            color: white;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        .sig-high { background-color: #d4edda; }
        .sig-medium { background-color: #fff3cd; }
        .sig-low { background-color: #f8d7da; }
        .metric { font-weight: bold; }
        .timestamp {
            color: #888;
            font-size: 0.9em;
        }
        img {
            max-width: 100%;
            margin: 20px 0;
            border: 1px solid #ddd;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Intermediate Value Models - Correlation Analysis Report</h1>
        <p class="timestamp">Generated: 2025-10-13 20:59:02</p>
        
        <h2>Overall Ranking (Top 20)</h2>
        <table>
            <tr>
                <th>Rank</th>
                <th>Algorithm</th>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>CPU Mean</th>
            </tr>

            <tr class="sig-medium">
                <td>1</td>
                <td>SM2</td>
                <td>scalar_mult_step</td>
                <td class="metric">0.4387</td>
                <td>0.036261</td>
                <td>moderate</td>
                <td>43.94%</td>
            </tr>

            <tr class="sig-low">
                <td>2</td>
                <td>AES-128</td>
                <td>hw_round_key_xor</td>
                <td class="metric">0.3122</td>
                <td>0.146968</td>
                <td>moderate</td>
                <td>41.97%</td>
            </tr>

            <tr class="sig-low">
                <td>3</td>
                <td>SM2</td>
                <td>point_dbl_x</td>
                <td class="metric">0.2884</td>
                <td>0.182068</td>
                <td>weak</td>
                <td>44.71%</td>
            </tr>

            <tr class="sig-low">
                <td>4</td>
                <td>ECC-P256</td>
                <td>point_add_x</td>
                <td class="metric">0.2824</td>
                <td>0.191654</td>
                <td>weak</td>
                <td>45.76%</td>
            </tr>

            <tr class="sig-low">
                <td>5</td>
                <td>SM2</td>
                <td>point_add_x</td>
                <td class="metric">0.2763</td>
                <td>0.191212</td>
                <td>weak</td>
                <td>43.87%</td>
            </tr>

            <tr class="sig-low">
                <td>6</td>
                <td>SM4</td>
                <td>sbox_input</td>
                <td class="metric">0.2594</td>
                <td>0.221020</td>
                <td>weak</td>
                <td>44.13%</td>
            </tr>

            <tr class="sig-low">
                <td>7</td>
                <td>RSA-2048</td>
                <td>modular_add</td>
                <td class="metric">0.2373</td>
                <td>0.275676</td>
                <td>weak</td>
                <td>40.91%</td>
            </tr>

            <tr class="sig-low">
                <td>8</td>
                <td>Dilithium-2</td>
                <td>modular_red</td>
                <td class="metric">0.2366</td>
                <td>0.265730</td>
                <td>weak</td>
                <td>45.75%</td>
            </tr>

            <tr class="sig-low">
                <td>9</td>
                <td>SM4</td>
                <td>hw_sbox_output</td>
                <td class="metric">0.2289</td>
                <td>0.281883</td>
                <td>weak</td>
                <td>42.81%</td>
            </tr>

            <tr class="sig-low">
                <td>10</td>
                <td>AES-128</td>
                <td>sbox_input</td>
                <td class="metric">0.2261</td>
                <td>0.287970</td>
                <td>weak</td>
                <td>44.72%</td>
            </tr>

            <tr class="sig-low">
                <td>11</td>
                <td>AES-128</td>
                <td>hd_plaintext_sbox</td>
                <td class="metric">0.1942</td>
                <td>0.352241</td>
                <td>weak</td>
                <td>39.93%</td>
            </tr>

            <tr class="sig-low">
                <td>12</td>
                <td>SM4</td>
                <td>tau_transform</td>
                <td class="metric">0.1880</td>
                <td>0.378968</td>
                <td>weak</td>
                <td>42.12%</td>
            </tr>

            <tr class="sig-low">
                <td>13</td>
                <td>RSA-2048</td>
                <td>modular_mult</td>
                <td class="metric">0.1800</td>
                <td>0.411153</td>
                <td>weak</td>
                <td>209.96%</td>
            </tr>

            <tr class="sig-low">
                <td>14</td>
                <td>RSA-2048</td>
                <td>hw_result</td>
                <td class="metric">0.1645</td>
                <td>0.442383</td>
                <td>weak</td>
                <td>43.60%</td>
            </tr>

            <tr class="sig-low">
                <td>15</td>
                <td>Dilithium-2</td>
                <td>rejection_sampling</td>
                <td class="metric">0.1544</td>
                <td>0.471416</td>
                <td>weak</td>
                <td>44.82%</td>
            </tr>

            <tr class="sig-low">
                <td>16</td>
                <td>ECC-P256</td>
                <td>scalar_mult_step</td>
                <td class="metric">0.1509</td>
                <td>0.481392</td>
                <td>weak</td>
                <td>45.81%</td>
            </tr>

            <tr class="sig-low">
                <td>17</td>
                <td>ECC-P256</td>
                <td>point_dbl_x</td>
                <td class="metric">0.1499</td>
                <td>0.474461</td>
                <td>weak</td>
                <td>46.46%</td>
            </tr>

            <tr class="sig-low">
                <td>18</td>
                <td>AES-128</td>
                <td>round_key_xor</td>
                <td class="metric">0.1462</td>
                <td>0.505667</td>
                <td>weak</td>
                <td>43.18%</td>
            </tr>

            <tr class="sig-low">
                <td>19</td>
                <td>AES-128</td>
                <td>sbox_output</td>
                <td class="metric">0.1227</td>
                <td>0.577060</td>
                <td>weak</td>
                <td>46.17%</td>
            </tr>

            <tr class="sig-low">
                <td>20</td>
                <td>AES-128</td>
                <td>hw_sbox_output</td>
                <td class="metric">0.1084</td>
                <td>0.614280</td>
                <td>weak</td>
                <td>51.14%</td>
            </tr>

        </table>
        
        <h2>Visualization</h2>
        <img src="overall_ranking.png" alt="Overall Ranking">
        <img src="algorithm_comparison.png" alt="Algorithm Comparison">
        
        <h2>By Algorithm</h2>

        <h3>AES-128</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>hw_round_key_xor</td>
                <td class="metric">0.3122</td>
                <td>0.146968</td>
                <td>moderate</td>
                <td>0.3040</td>
                <td>41.97%</td>
                <td>6</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.2261</td>
                <td>0.287970</td>
                <td>weak</td>
                <td>-0.1916</td>
                <td>44.72%</td>
                <td>22</td>
            </tr>

            <tr class="sig-low">
                <td>hd_plaintext_sbox</td>
                <td class="metric">0.1942</td>
                <td>0.352241</td>
                <td>weak</td>
                <td>0.2149</td>
                <td>39.93%</td>
                <td>5</td>
            </tr>

            <tr class="sig-low">
                <td>round_key_xor</td>
                <td class="metric">0.1462</td>
                <td>0.505667</td>
                <td>weak</td>
                <td>0.2041</td>
                <td>43.18%</td>
                <td>24</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.1227</td>
                <td>0.577060</td>
                <td>weak</td>
                <td>-0.2184</td>
                <td>46.17%</td>
                <td>24</td>
            </tr>

            <tr class="sig-low">
                <td>hw_sbox_output</td>
                <td class="metric">0.1084</td>
                <td>0.614280</td>
                <td>weak</td>
                <td>-0.0158</td>
                <td>51.14%</td>
                <td>7</td>
            </tr>

        </table>

        <h3>Dilithium-2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>modular_red</td>
                <td class="metric">0.2366</td>
                <td>0.265730</td>
                <td>weak</td>
                <td>0.1796</td>
                <td>45.75%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>rejection_sampling</td>
                <td class="metric">0.1544</td>
                <td>0.471416</td>
                <td>weak</td>
                <td>0.1461</td>
                <td>44.82%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>poly_mult</td>
                <td class="metric">0.0685</td>
                <td>0.756197</td>
                <td>very_weak</td>
                <td>0.0049</td>
                <td>40.96%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>ntt_butterfly</td>
                <td class="metric">0.0001</td>
                <td>0.999755</td>
                <td>very_weak</td>
                <td>0.1561</td>
                <td>48.50%</td>
                <td>25</td>
            </tr>

        </table>

        <h3>ECC-P256</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>point_add_x</td>
                <td class="metric">0.2824</td>
                <td>0.191654</td>
                <td>weak</td>
                <td>0.2648</td>
                <td>45.76%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>scalar_mult_step</td>
                <td class="metric">0.1509</td>
                <td>0.481392</td>
                <td>weak</td>
                <td>-0.0800</td>
                <td>45.81%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.1499</td>
                <td>0.474461</td>
                <td>weak</td>
                <td>-0.0800</td>
                <td>46.46%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>hw_coordinate</td>
                <td class="metric">0.0694</td>
                <td>0.747145</td>
                <td>very_weak</td>
                <td>0.0546</td>
                <td>42.24%</td>
                <td>10</td>
            </tr>

        </table>

        <h3>RSA-2048</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>modular_add</td>
                <td class="metric">0.2373</td>
                <td>0.275676</td>
                <td>weak</td>
                <td>0.1630</td>
                <td>40.91%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>modular_mult</td>
                <td class="metric">0.1800</td>
                <td>0.411153</td>
                <td>weak</td>
                <td>0.3597</td>
                <td>209.96%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>hw_result</td>
                <td class="metric">0.1645</td>
                <td>0.442383</td>
                <td>weak</td>
                <td>0.1449</td>
                <td>43.60%</td>
                <td>8</td>
            </tr>

            <tr class="sig-low">
                <td>square_op</td>
                <td class="metric">0.1047</td>
                <td>0.626335</td>
                <td>weak</td>
                <td>-0.0257</td>
                <td>43.66%</td>
                <td>25</td>
            </tr>

        </table>

        <h3>SM2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-medium">
                <td>scalar_mult_step</td>
                <td class="metric">0.4387</td>
                <td>0.036261</td>
                <td>moderate</td>
                <td>-0.4881</td>
                <td>43.94%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.2884</td>
                <td>0.182068</td>
                <td>weak</td>
                <td>-0.2668</td>
                <td>44.71%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>point_add_x</td>
                <td class="metric">0.2763</td>
                <td>0.191212</td>
                <td>weak</td>
                <td>-0.3170</td>
                <td>43.87%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>modular_op</td>
                <td class="metric">0.1047</td>
                <td>0.634424</td>
                <td>weak</td>
                <td>0.0010</td>
                <td>49.40%</td>
                <td>25</td>
            </tr>

        </table>

        <h3>SM4</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.2594</td>
                <td>0.221020</td>
                <td>weak</td>
                <td>0.1557</td>
                <td>44.13%</td>
                <td>24</td>
            </tr>

            <tr class="sig-low">
                <td>hw_sbox_output</td>
                <td class="metric">0.2289</td>
                <td>0.281883</td>
                <td>weak</td>
                <td>-0.4348</td>
                <td>42.81%</td>
                <td>7</td>
            </tr>

            <tr class="sig-low">
                <td>tau_transform</td>
                <td class="metric">0.1880</td>
                <td>0.378968</td>
                <td>weak</td>
                <td>-0.0052</td>
                <td>42.12%</td>
                <td>25</td>
            </tr>

            <tr class="sig-low">
                <td>round_function_input</td>
                <td class="metric">0.1037</td>
                <td>0.621653</td>
                <td>weak</td>
                <td>0.1313</td>
                <td>42.15%</td>
                <td>24</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.0547</td>
                <td>0.799488</td>
                <td>very_weak</td>
                <td>0.0713</td>
                <td>42.96%</td>
                <td>24</td>
            </tr>

        </table>

        <h2>Legend</h2>
        <ul>
            <li><strong>|Pearson|:</strong> Absolute value of Pearson correlation coefficient (0-1)</li>
            <li><strong>P-value:</strong> Statistical significance (< 0.05 is significant)</li>
            <li><strong>Significance:</strong> Correlation strength category</li>
            <li><strong>CPU Mean:</strong> Average CPU usage during trace collection</li>
            <li class="sig-high">Green background: Highly significant (p < 0.01)</li>
            <li class="sig-medium">Yellow background: Significant (p < 0.05)</li>
            <li class="sig-low">Red background: Not significant (p >= 0.05)</li>
        </ul>
    </div>
</body>
</html>
